import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import dict from './plugin/useDict'
import router from './router'

import permission from './store/permission'
import './style/common.less'
import './assets/common.css'

const app = createApp(App);
app.use(dict);
app.use(createPinia());
app.use(permission);
app.use(router);
app.mount('#app');


console.log('__DEV__', __DEV__)


const themeWithSystem = (type: boolean) => {
    if (type) {
        console.log('深色');
    } else {
        console.log('浅色')
    }
}


let matchResult = window.matchMedia('(prefers-color-scheme: dark)');
// console.log('result', matchResult, )
console.log('初始化');
themeWithSystem(matchResult.matches)


matchResult.addEventListener('change', (e) => {
    console.log('变色了!');
    themeWithSystem(e.matches)
})